#pragma once

#include "MyActiveInterface.h"

namespace CO { namespace MyGroupNamespace { namespace MyPackageNamespace {


//
// Message handler to allow more modular design.
//
class MyHsmMessageHandler :	public SpiFoundation::RoomFW::HsmMessageHandler
{
public:

	//
	// Smart Pointer type.
	//
	typedef boost::shared_ptr<MyHsmMessageHandler> Ptr;
	typedef SpiFoundation::RoomFW::NullDeleter<MyHsmMessageHandler> NullDeleter;

	//
	// Ctor.
	//
	MyHsmMessageHandler(SpiFoundation::RoomFW::ActiveObject* parent);

	//
	// ISystemComponent overrides.
	//
	virtual bool initialize(SpiFoundation::Configuration::ConfigKey& configRoot);

protected:

	//
	// TODO:  Define an initial state, distinct from normal states.
	//
	static void Initial(MyHsmMessageHandler* me, QEvent const *evt);

	//
	// QHsm defines states as static methods.  They take the this pointer
	// and an event as parameters and return 0 if they handled the event
	// or their parent state if they did not handle the event.  That's how
	// the hierarchy is established, by the state handler return values.
	//
	// Note:  This HSM has three states:  StateA which contains StateB and StateC.
	//
	static QSTATE StateA(MyHsmMessageHandler* me, QEvent const *evt);
	static QSTATE StateB(MyHsmMessageHandler* me, QEvent const *evt);
	static QSTATE StateC(MyHsmMessageHandler* me, QEvent const *evt);

private:

	//
	// TODO:  Add private attributes.
	//
	long myConfigValue_;
};
//
// TODO:  Add a smart pointer typedef for your class.
//
typedef ::boost::shared_ptr<MyHsmMessageHandler> MyHsmMessageHandlerSP;

}}} // End namespace
